package com.itheima.day03_extends.homework01;

public class Test01 {
    public static void main(String[] args) {
        Person p = new Person("张三", 23, "1991-11-11");
        String info = p.getInfo();
        System.out.println(info);
        Student stu = new Student("李四", 24, "1990-11-11", "一中");
        String stuInfo = stu.getInfo();
        System.out.println(stuInfo);
    }
}

class Person {
    private String name; // 姓名
    private int age; // 年龄
    private String birthday; // 生日

    public Person() {
    }

    public Person(String name, int age, String birthday) {
        this.name = name;
        this.age = age;
        this.birthday = birthday;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    // 获取信息的方法
    public String getInfo() {
        return "Person[name=" + name + ", age=" + age + ", birthday=" + birthday + "]";
    }
}

class Student extends Person {

    private String school; // 所在学校

    public Student() {
    }

    public Student(String name, int age, String birthday, String school) {
        super(name, age, birthday);
        this.school = school;
    }

    // 获取信息的方法
    public String getInfo() {
        return "Student[name=" + getName() + ", age=" + getAge() + ", birthday=" + getBirthday() + ", school=" + school + "]";
    }
}